package com.example.demo2.controller;

import com.example.demo2.reqvo.DlpReportReqVO;
import com.example.demo2.resvo.DlpTokenResVO;
import com.example.demo2.resvo.ResponseVO;
import com.example.demo2.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
public class TestController {
    @Autowired
    TestService testService;

    // 测试数据
    // {"data":"O5yDVMZYtuSx2ZV9a3tcI4IrBUkuBPqprS07e1OWWgzCWhkoVaxt+D7vhdj+ut5RKgC13OU+rD8M2Eeg4/TPHqHZmrW12QSWsNIQ71EdP5WgYMoeGfa8Ywh4oIFyZkpa","nonce":"ZrTmQchjXsJDGgYu","signature":"VhiEhz0GZOcnffwC7CFfUjX5MsQPwXPTJWiU9APZl5g=","timestamp":1681806026}
    /**
     * 接受dlp状态变化
     * @param reqVO 请求体
     * @return
     */
    @PostMapping("/accept/device_status")
    public ResponseVO<Void> acceptDeviceStatus(@RequestBody @Valid DlpReportReqVO reqVO) {
        return testService.acceptDeviceStatus(reqVO);
    }

    /**
     * 获取dlp的token
     * @return
     */
    @PostMapping("/oauth/token")
    public ResponseVO<DlpTokenResVO> getDlpToken() {
        return testService.getDlpToken();
    }
}
